<template>
  <div class="app-container">
    <!--        <div style="margin-bottom:15px;">-->
    <!--            <el-radio-group v-model="editPage">-->
    <!--                <el-radio-button label="客户管理"></el-radio-button>-->
    <!--                <el-radio-button label="客户推荐"></el-radio-button>-->
    <!--            </el-radio-group>-->
    <!--        </div>-->
    <avue-crud
      v-if="editPage=='客户管理'"
      :option="option"
      :data="data"
      :table-loading="loading"
      :page.sync="page"
      @on-load="onLoad"
      @current-change="currentChange"
      @selection-change="selectionChange"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="resetChange"
    >
      <template
        slot="icon"
        slot-scope="scope"
      >
        <div v-if="scope.row.icon">
          <svg-icon :icon-class="scope.row.icon"></svg-icon>
        </div>
      </template>
      <template slot="menuLeft">
        <div style="display:inline-block;">
          <div style="display:flex">
            <!--                        <el-button type="primary" size="small" @click="addFromSour" icon="el-icon-plus">-->
            <!--                            新 增-->
            <!--                        </el-button>-->
            <!--                        <el-upload :show-file-list="false" :before-upload="beforeUpload" :on-success="onSuccess"-->
            <!--                            :on-error="onError" :headers="headers" :action="importCustomer">-->
            <!--                            <el-button type="primary" size="small" :icon="importDataBtnIcon">-->
            <!--                                {{importDataBtnText}}-->
            <!--                            </el-button>-->
            <!--                        </el-upload>-->
            <!--                        <el-button size="small" type="primary" @click="downloadTemp" icon="el-icon-download">-->
            <!--                            模板下载-->
            <!--                        </el-button>-->
            <el-button
              size="small"
              type="primary"
              @click="moveToW"
              icon="el-icon-right"
              v-has="'recommendSubscribe'"
            >
              订阅
            </el-button>
            <!-- <el-button size="small" type="primary"  @click="moveToPur" icon="el-icon-right" v-has="'recommendToPurpose'">
                            移至意向客户
                        </el-button> -->
          </div>
        </div>

      </template>
      <template
        slot="menu"
        slot-scope="scope"
      >
        <el-button
          size="small"
          type="text"
          @click="checkOpen(scope.row)"
          icon="el-icon-view"
        >查看</el-button>
        <!-- <el-button size="small" type="text" @click="rowDel(scope.row)" icon="el-icon-delete">删除</el-button> -->
      </template>
    </avue-crud>
    <avue-crud
      ref="ccc"
      v-if="editPage=='客户推荐'"
      :option="option1"
      :data="data1"
      :table-loading="loading"
      :page.sync="page1"
      @on-load="onLoad1"
      @row-save="rowSave"
      @row-update="rowUpdate"
      @current-change="currentChange"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="resetChange"
    >
      <template
        slot="icon"
        slot-scope="scope"
      >
        <div v-if="scope.row.icon">
          <svg-icon :icon-class="scope.row.icon"></svg-icon>
        </div>
      </template>

      <template slot="menuLeft">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="small"
          plain
          @click.stop="owAdd"
        >加入客户
        </el-button>
      </template>
    </avue-crud>

    <el-dialog
      title="意向客户"
      :visible.sync="type1"
      class="avue-dialog avue-dialog--top"
      width="60%"
    >
      <div style="padding-bottom: 20px;">
        <avue-crud
          :data="yxData"
          :option="yxOption"
          v-model="yxForm"
          @on-load="onLoadyx"
        ></avue-crud>
      </div>
      <div
        class="avue-dialog__footer"
        style="text-align: right;"
      >
        <el-button
          size="small"
          @click="type1=false"
        >取 消</el-button>
        <el-button
          size="small"
          @click="type1=false"
          type="primary"
        >确 定</el-button>
      </div>
    </el-dialog>
    <company
      :openDialog="openDialog"
      :title="title"
      :qylxList="qylxList"
      ref="company"
      @save="save"
      @handleReset="handleReset"
    />
    <!-- 查看 -->
    <el-dialog
      title="查看"
      :visible.sync="checkDialog"
      width="60%"
      center
    >
      <el-form
        ref="form"
        :model="dataList"
        label-width="100px"
      >
        <div class="message">
          <div class="module">
            <el-tabs v-model="active">
              <el-tab-pane
                label="企业信息"
                name="first"
              >
                <table class="detailtable">
                  <tr>
                    <td width="15%">企业名称</td>
                    <td width="35%">{{dataList.qymc}}</td>
                    <td width="15%">统一社会信用代码</td>
                    <td width="35%">{{dataList.shtyxydm}}</td>
                  </tr>
                  <tr>
                    <td width="15%">法人姓名</td>
                    <td width="35%">{{dataList.fddbr}}</td>
                    <!-- <td width="15%">联系方式</td>
                                        <td width="35%">{{dataList.dh}}</td> -->
                    <td width="15%">注册时间</td>
                    <td width="35%">{{dataList.clrq}}</td>
                  </tr>
                  <tr>
                    <td width="15%">注册资金</td>
                    <td width="35%">{{dataList.zczb}}万元</td>
                    <td width="15%">所属行业</td>
                    <td width="35%">{{dataList.sshy}}</td>
                  </tr>
                  <tr>
                    <td width="15%">所属区域</td>
                    <td width="35%">{{dataList.ssqu}}</td>
                  </tr>
                  <tr>
                    <td width="15%">企业类型</td>
                    <td colspan="3">{{dataList.qylx | filterQylx(qylxList)}}</td>
                  </tr>
                  <tr>
                    <td width="15%">注册地址</td>
                    <td colspan="3">{{dataList.zs}}</td>
                  </tr>
                </table>
              </el-tab-pane>
            </el-tabs>
          </div>
          <!--                    <div class="module">-->
          <!--                        <el-tabs v-model="active">-->
          <!--                            <el-tab-pane label="法人信息" name="first">-->
          <!--                                <table class="detailtable">-->
          <!--                                    <tr>-->
          <!--                                        <td width="15%">法人姓名</td>-->
          <!--                                        <td width="35%">{{dataList.fddbr}}</td>-->
          <!--                                        <td width="15%">性别</td>-->
          <!--                                        <td width="35%">{{dataList.xb}}</td>-->
          <!--                                    </tr>-->
          <!--                                    <tr>-->
          <!--                                        <td width="15%">出生日期</td>-->
          <!--                                        <td width="35%">{{dataList.csrq}}</td>-->
          <!--                                        <td width="15%">学历</td>-->
          <!--                                        <td width="35%">{{dataList.xl}}</td>-->
          <!--                                        &lt;!&ndash; <td width="15%">籍贯</td>-->
          <!--                                        <td>{{dataList.jg}}</td>-->
          <!--                                        <td width="15%">婚姻状况</td>-->
          <!--                                        <td>{{dataList.hyzk}}</td> &ndash;&gt;-->
          <!--                                    </tr>-->
          <!--                                    <tr>-->
          <!--                                        <td width="15%">证件号码</td>-->
          <!--                                        <td width="35%">{{dataList.sfzjhm}}</td>-->
          <!--                                        <td width="15%">电话号码</td>-->
          <!--                                        <td width="35%">{{dataList.lxdh}}</td>-->
          <!--                                        &lt;!&ndash; <td width="15%">邮箱</td>-->
          <!--                                        <td>{{dataList.yx}}</td> &ndash;&gt;-->
          <!--                                    </tr>-->
          <!--                                    &lt;!&ndash; <tr>-->
          <!--                                        <td width="15%">联系地址</td>-->
          <!--                                        <td colspan="5">{{dataList.zs}}</td>-->
          <!--                                    </tr> &ndash;&gt;-->
          <!--                                </table>-->
          <!--                            </el-tab-pane>-->
          <!--                        </el-tabs>-->
          <!--                    </div>-->
        </div>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import {
  addW,
  getR,
  getC,
  moveToWhiteFormRecmd,
  moveToPurposeFormRecmd,
  delW,
} from '@/api/manager.js'
import company from './company'
import store from '@/store'
import { getField } from '@/api/user.js'
export default {
  components: {
    company,
  },
  data() {
    return {
      loading: false,
      form: {},
      yxForm: {},
      editPage: '客户管理',
      type1: false,
      openDialog: false,
      qylxList: [],
      title: '新增订阅客户',
      selectionList: [],

      checkDialog: false,
      dataList: {},
      active: 'first',
      searchList: {},
      /* 分页 */
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        background: false,
      },
      page1: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        background: false,
      },
      importCustomer: '',
      importDataBtnText: '导 入',
      importDataBtnIcon: 'el-icon-upload2',
      importDataDisabled: false,
      data: [
        {
          id: 1,
          deptValue: '机构1',
          orgCode: '编号',
          deptPid: '上级机构',
          oindex: 1,
          icon: 'back',
          note: '信息描述',
        },
      ],
      data1: [
        {
          id: 1,
          deptValue: '机构1',
          orgCode: '编号',
          deptPid: '上级机构',
          oindex: 1,
          icon: 'back',
          note: '信息描述',
        },
      ],
      yxData: [],
      yxOption: {
        border: true,
        selection: true,
        addBtn: false,
        refreshBtn: false,
        columnBtn: false,
        align: 'center',
        menuAlign: 'center',
        column: [
          {
            label: '企业名称',
            prop: 'qymc',
            display: false,
          },
          {
            label: '统一社会信用代码',
            prop: 'qyshxydm',
            display: false,
          },
          {
            label: '企业类型',
            prop: 'qylx',
            display: false,
            type: 'select',
            dicData: [
              {
                label: '小微企业',
                value: '1',
              },
              {
                label: '中型企业',
                value: '2',
              },
              {
                label: '大型企业',
                value: '3',
              },
              {
                label: '超大型企业',
                value: '4',
              },
              {
                label: '个体工商户',
                value: '5',
              },
            ],
          },
          {
            label: '法人姓名',
            prop: 'frxm',
            display: false,
          },
          {
            label: '企业综合评分',
            prop: 'score',
            display: false,
          },
          {
            label: '联系方式',
            prop: 'phone',
            display: false,
          },
          // {
          //     label: '创建时间',
          //     prop: 'createTime',
          //     display: false
          // },
        ],
      },
      option: {
        headerAlign: 'center',
        align: 'center',
        border: true,
        /* index: true,
                    indexLabel: '序号',
                    indexWidth: 100, */
        card: true,
        defaultExpandAll: true,
        dialogDrag: false,
        labelWidth: 135,
        viewBtn: false,
        delBtn: false,
        excelBtn: false,
        editBtn: false,
        addBtn: false,
        selection: true,
        searchLabelWidth: '25%',
        searchSpan: 6,
        searchMenuSpan: 4,
        delBtn: false,
        columnBtn: false,
        refreshBtn: false,
        selectClearBtn: false,
        // searchBtn: true,
        searchShowBtn: false,

        column: [
          {
            label: '企业名称',
            prop: 'qymc',
            display: false,
            search: true,
          },
          {
            label: '统一社会信用代码',
            prop: 'shtyxydm',
            display: false,
            search: true,
            searchLabelWidth: '35%',
          },
          {
            label: '企业类型',
            prop: 'qylx',
            type: 'select',
            dicData: [],
            display: false,
          },
          {
            label: '法人姓名',
            prop: 'fddbr',
            display: false,
            search: true,
            width: 120,
          },
          /* {
                            label: '企业综合评分',
                            prop: 'score',
                            display: false,
                            type: 'select',
                            dicData: [{
                                label: '全部',
                                value: ''
                            }, {
                                label: '85分以上',
                                value: '1'
                            }, {
                                label: '90分以上',
                                value: '2'
                            }, {
                                label: '95分以上',
                                value: '3'
                            }],
                            search: false
                        }, */
          // {
          //     label: '联系方式',
          //     prop: 'dh',
          //     display: false
          // },
          {
            label: '推荐时间',
            prop: 'month',
            display: false,
            width: 120,
          },
          // {
          //     label: '创建时间',
          //     prop: 'createTime',
          //     display: false
          // },
        ],
        group: [
          {
            icon: 'el-icon-info',
            label: '企业信息',
            collapse: true,
            column: [
              {
                label: '企业名称',
                prop: 'qymc',
              },
              {
                label: '统一社会信用代码',
                prop: 'shtyxydm',
              },
              {
                label: '注册时间',
                prop: 'clrq',
                type: 'date',
              },
              {
                label: '注册资金',
                prop: 'zczb',
              },
              {
                label: '企业类型',
                prop: 'qylx',
                type: 'select',
                dicData: [
                  {
                    label: '小微企业',
                    value: '1',
                  },
                  {
                    label: '中型企业',
                    value: '2',
                  },
                  {
                    label: '大型企业',
                    value: '3',
                  },
                  {
                    label: '超大型企业',
                    value: '4',
                  },
                  {
                    label: '个体工商户',
                    value: '5',
                  },
                ],
              },
              {
                label: '所属行业',
                prop: 'sshy',
                type: 'select',
                dicData: [
                  {
                    label: '请选择',
                    value: '',
                  },
                  {
                    label: '农林牧渔业',
                    value: '0',
                  },
                  {
                    label: '教育',
                    value: '1',
                  },
                  {
                    label: '采矿业',
                    value: '2',
                  },
                ],
              },
              {
                label: '所属区域',
                prop: 'ssqu',
              },
              {
                label: '注册地址',
                prop: 'zs',
              },
              {
                label: '企业联系方式',
                prop: 'dh',
              },
            ],
          },
          {
            icon: 'el-icon-info',
            label: '法人信息',
            collapse: true,
            column: [
              {
                label: '法人姓名',
                prop: 'fddbr',
              },
              {
                label: '性别',
                prop: 'xb',
              },
              {
                label: '出生日期',
                type: 'date',
                prop: 'csrq',
              },
              {
                label: '籍贯',
                prop: 'jg',
              },
              {
                label: '婚姻状况',
                prop: 'hyzk',
              },
              {
                label: '学历',
                prop: 'xl',
              },

              {
                label: '身份证',
                prop: 'sfzjhm',
              },
              {
                label: '手机号',
                prop: 'lxdh',
              },
              {
                label: '邮箱',
                prop: 'yx',
              },
              {
                label: '联系地址',
                prop: 'dz',
              },
            ],
          },
        ],
      },
      option1: {
        headerAlign: 'center',
        align: 'center',
        border: true,
        index: true,
        indexLabel: '序号',
        indexWidth: 100,
        card: true,
        defaultExpandAll: true,
        dialogDrag: false,
        labelWidth: 135,
        viewBtn: true,
        searchSpan: 8,
        searchMenuSpan: 4,
        searchLabelWidth: '20%',
        addBtn: false,
        editBtn: false,
        delBtn: false,
        column: [
          {
            label: '企业名称',
            prop: 'qymc',
            display: false,
            search: true,
          },
          {
            label: '统一社会信用代码',
            prop: 'qyshxydm',
            display: false,
            search: true,
          },
          {
            label: '企业类型',
            prop: 'qylx',
            type: 'select',
            dicData: [
              {
                label: '小微企业',
                value: '1',
              },
              {
                label: '中型企业',
                value: '2',
              },
              {
                label: '大型企业',
                value: '3',
              },
              {
                label: '超大型企业',
                value: '4',
              },
              {
                label: '个体工商户',
                value: '5',
              },
            ],
            display: false,
            search: true,
          },
          {
            label: '法人姓名',
            prop: 'frxm',
            display: false,
            search: true,
          },
          {
            label: '企业综合评分',
            prop: 'score',
            display: false,
            type: 'select',
            dicData: [
              {
                label: '全部',
                value: '',
              },
              {
                label: '85分以上',
                value: '1',
              },
              {
                label: '90分以上',
                value: '2',
              },
              {
                label: '95分以上',
                value: '3',
              },
            ],
            search: true,
          },
          // {
          //     label: '联系方式',
          //     prop: 'phone',
          //     display: false
          // },
          // {
          //     label: '创建时间',
          //     prop: 'createTime',
          //     display: false
          // },
        ],
        group: [
          {
            icon: 'el-icon-info',
            label: '企业信息',
            collapse: true,
            column: [
              {
                label: '企业名称',
                prop: 'qymc',
              },
              {
                label: '统一社会信用代码',
                prop: 'qyshxydm',
              },
              {
                label: '注册时间',
                prop: 'gszcdjrq',
                type: 'date',
              },
              {
                label: '注册资金',
                prop: 'zczb',
              },
              {
                label: '企业类型',
                prop: 'qylx',
                type: 'select',
                dicData: [
                  {
                    label: '小微企业',
                    value: '1',
                  },
                  {
                    label: '中型企业',
                    value: '2',
                  },
                  {
                    label: '大型企业',
                    value: '3',
                  },
                  {
                    label: '超大型企业',
                    value: '4',
                  },
                  {
                    label: '个体工商户',
                    value: '5',
                  },
                ],
              },
              {
                label: '所属行业',
                prop: 'sshy',
                type: 'select',
                dicData: [
                  {
                    label: '请选择',
                    value: '',
                  },
                  {
                    label: '农林牧渔业',
                    value: '0',
                  },
                  {
                    label: '教育',
                    value: '1',
                  },
                  {
                    label: '采矿业',
                    value: '2',
                  },
                ],
              },
              {
                label: '注册地址',
                prop: 'zcdz',
              },
              {
                label: '企业性质',
                prop: 'qyxz',
              },
              {
                label: '企业联系方式',
                prop: 'qylxfs',
              },
              {
                label: '企业综合评分',
                prop: 'score',
              },
            ],
          },
          {
            icon: 'el-icon-info',
            label: '法人信息',
            collapse: true,
            column: [
              {
                label: '法人姓名',
                prop: 'frxm',
              },
              {
                label: '性别',
                prop: 'sex',
                type: 'select',
                dicData: [
                  {
                    label: '男',
                    value: '1',
                  },
                  {
                    label: '女',
                    value: '0',
                  },
                ],
              },
              {
                label: '出生日期',
                type: 'date',
                prop: 'birthday',
              },
              {
                label: '籍贯',
                prop: 'nativePlace',
              },
              {
                label: '婚姻状况',
                prop: 'maritalStatus',
                type: 'select',
                dicData: [
                  {
                    label: '已婚',
                    value: '1',
                  },
                  {
                    label: '未婚',
                    value: '0',
                  },
                ],
              },
              {
                label: '学历',
                prop: 'education',
                type: 'select',
                dicData: [
                  {
                    label: '请选择',
                    value: '',
                  },
                  {
                    label: '专科',
                    value: '0',
                  },
                  {
                    label: '本科',
                    value: '1',
                  },
                  {
                    label: '其他',
                    value: '2',
                  },
                ],
              },

              {
                label: '身份证',
                prop: 'idCard',
              },
              {
                label: '手机号',
                prop: 'phone',
              },
              {
                label: '邮箱',
                prop: 'email',
              },
              {
                label: '联系地址',
                prop: 'contactAdress',
              },
            ],
          },
        ],
      },
    }
  },
  created() {
    /* var buttonpermsStr = JSON.parse(localStorage.getItem('btnList'));
            this.option.excelBtn = buttonpermsStr.indexOf('recommendExport') > -1 ? true:false; */
    let params = {
      page: 1,
      size: 100,
      code: 'QYLX',
    }
    getField(params).then((res) => {
      if (res.status) {
        this.qylxList = res.data.records
        this.option.column[2].dicData = res.data.records.map((item) => {
          return { label: item.fieldName, value: item.fieldCode }
        })
      }
    })
  },
  computed: {
    headers() {
      return {
        TOKEN: this.$store.getters.token,
      }
    },
  },
  filters: {
    filterQylx(val, qylxList) {
      if (!val) return
      var isnum = /^\d+$/.test(val)
      if (isnum) {
        return qylxList.filter((item) => item.fieldCode == val)[0].fieldName
      } else {
        return val
      }
    },
  },
  methods: {
    onLoad(page, params = {}) {
      let baseUrl2 = process.env.VUE_APP_BASE_API
      this.importCustomer = baseUrl2 + '/customer/white/import'

      this.downCustomerTmp = baseUrl2 + '/customer/white/downloadTemp'

      let searchList = this.searchList
      Object.assign(params, {
        ...searchList,
        pageNum: this.page.currentPage,
        pageSize: this.page.pageSize,
      })
      /* if (page.layout) {
                    Object.assign(params, {
                        page: 1,
                        size: 10,
                    });
                } else {
                    Object.assign(params, page);
                } */
      this.loading = true
      getR(params).then((data) => {
        if (data.status) {
          this.loading = false
          this.data = data.data.records
          this.page.total = data.data.total
        }
      })
    },
    onLoad1(page, params = {}) {
      if (page.layout) {
        Object.assign(params, {
          page: 1,
          size: 10,
        })
      } else {
        Object.assign(params, page)
      }
      this.loading = true
      getR(params).then((data) => {
        if (data.status) {
          this.loading = false
          this.data1 = data.data.records
          this.page1.total = data.data.total
        }
      })
    },
    onLoadyx(page, params = {}) {
      if (page.layout) {
        Object.assign(params, {
          page: 1,
          size: 10,
        })
      } else {
        Object.assign(params, page)
      }
      this.loading = true
      getC(params).then((data) => {
        if (data.status) {
          this.loading = false
          this.yxData = data.data.records
          this.page.total = data.data.total
        }
      })
    },
    selectionChange(selection, row) {
      this.selectionList = selection
    },
    beforeUpload() {
      this.importDataBtnText = '正在导入'
      this.importDataBtnIcon = 'el-icon-loading'
      this.importDataDisabled = true
    },
    onSuccess(response, file, fileList) {
      this.importDataBtnText = '导 入'
      this.importDataBtnIcon = 'el-icon-upload2'
      this.importDataDisabled = false
      console.log(response)
      this.onLoad(this.page)
      this.$message({
        type: 'success',
        message: '导入成功!',
      })
      // this.initEmps();
    },
    onError(err, file, fileList) {
      this.importDataBtnText = '导 入'
      this.importDataBtnIcon = 'el-icon-upload2'
      this.importDataDisabled = false
      this.onLoad(this.page)
      this.$message({
        type: 'error',
        message: '导入失败!',
      })
    },
    submitUpload() {
      var aa = store.state.token
      aa = store.getters.token
      aa = store.getters.access_token
      aa = this.$store.getters
      // debugger
      this.$refs.upload.submit()
    },
    downloadTemp() {
      document.location.href = this.downCustomerTmp
    },
    owAdd() {
      this.type1 = true
    },
    /* 清空 */
    resetChange() {
      this.page.currentPage = 1
      this.page.pageSize = 10
      this.searchList = {}
      this.onLoad()
    },
    /* 搜索筛选 */
    searchChange(params, done) {
      done()
      this.page.currentPage = 1
      this.page.pageSize = 10
      this.searchList = {
        ...params,
      }
      this.onLoad()
    },

    /* 新增 */
    rowSave(row, done, loading) {
      addW(row).then(
        (data) => {
          if (data.status) {
            this.onLoad(this.page)
            this.$message({
              type: 'success',
              message: '操作成功!',
            })
          }
          done()
        },
        (error) => {
          window.console.log(error)
          loading()
        }
      )
    },
    addFromSour() {
      // 显示窗口
      this.openDialog = true

      /* this.$nextTick(() => {
                        this.$refs.company.init();
                    }); */
      // this.company.init();
    },
    //新增取消
    handleReset(val) {
      this.openDialog = val
    },
    save(params) {
      addW(params).then(
        (data) => {
          if (data.status) {
            this.$message({
              type: 'success',
              message: '操作成功!',
            })
            this.onLoad(this.page)
            this.openDialog = false
            this.$refs.company.resetForm()
          } else {
            this.$message.error(data.msg)
          }
        },
        (error) => {
          window.console.log(error)
        }
      )
    },
    /* 查看 */
    checkOpen(row) {
      this.checkDialog = true
      this.dataList = { ...row }
    },
    /* 修改 */
    rowUpdate(row, index, done, loading) {
      delete row.createTime
      delete row.updateTime
      upCustomer(row).then(
        () => {
          done()
          this.onLoad(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          })
        },
        (error) => {
          window.console.log(error)
          loading()
        }
      )
    },
    /* 改变页码 */
    currentChange(currentPage) {
      console.log(';=currentChange', currentPage)
      this.page.currentPage = currentPage
    },
    /* 删除 */
    rowDel(row) {
      this.$confirm('确定将选择数据删除?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        delW({
          shtyxydm: row.shtyxydm,
        }).then(() => {
          this.onLoad(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          })
        })
      })
    },
    /* 移至意向客户 */
    moveToPur() {
      if (this.selectionList.length > 0) {
        this.$confirm('确定将选择的数据移至意向客户?', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        }).then(() => {
          let shtyxydms = this.selectionList
            .map((item) => item.shtyxydm)
            .join(',')
          moveToPurposeFormRecmd(shtyxydms).then((res) => {
            if (res.status) {
              if (res.msg) {
                this.onLoad(this.page)
                this.$message({
                  type: 'success',
                  message: res.msg,
                })
              }
            } else {
              this.onLoad(this.page)
              this.$message({
                type: 'error',
                message: res.msg,
              })
            }
          })
        })
      } else {
        this.$message({
          type: 'warning',
          message: '请勾选要移至意向客户的数据!',
        })
      }
    },
    /* 移至订阅客户 */
    moveToW() {
      if (this.selectionList.length > 0) {
        this.$confirm('确定将选择的数据移至订阅客户?', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        }).then(() => {
          let shtyxydms = this.selectionList
            .map((item) => item.shtyxydm)
            .join(',')
          moveToWhiteFormRecmd(shtyxydms).then(() => {
            this.onLoad(this.page)
            this.$message({
              type: 'success',
              message: '操作成功!',
            })
          })
        })
      } else {
        this.$message({
          type: 'warning',
          message: '请勾选要移至订阅客户的数据!',
        })
      }
    },
  },
}
</script>

<style scoped="scoped" lang="scss">
/deep/ .avue-crud__pagination {
  text-align: center;
}
.detailtable {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  border: #e5e5e5 solid 1px;
}
.detailtable tr {
  width: 100%;
}
.detailtable td {
  padding: 8px 10px;
  text-align: left;
  line-height: 24px;
  font-size: 14px;
  color: #434343;
  border: #e5e5e5 solid 1px;
}
.detailtable td {
  font-weight: normal;
  background-color: #fff;
}
.detailtable td {
  word-break: break-all;
}
</style>
